Copyright: helpC, (c) Copyright 1992,94 HyperAct, Inc.


Universal Directory Handler

UDH - Universal Directory Handler, is a file and directory management tool that can be extended by the user to perform sophisticated operations on groups of files, according to user defined selection criteria.

The UDH program includes HyperAct, Inc.'s PASTERP Pascal-Like language interpreter, with pre-defined procedure calls that can be altered by the user to manipulate files.

The standard UDH package includes several pre-defined useful file manipulation "commands", that can be used with no further programming.

Related Topics :

 File List

 Installation

 Theory of Operation

 Operation

 PASTERP Language

 Contact

 Registration


File List

The following files are included with the shareware evaluation package :

 UDH     .EXE   - The Universal Directory Handler program.

 UDH     .DOC   - The Universal Directory Handler documentation file.

 PASTERP .DOC   - The Pasterp language documentation file.

 DIR     .UDH   - A DIR command implementation in UDH.

 SIZESUM .UDH   - A Summery of files sizes, in directories, and

                  optionally, sub-directories.

 DELALL  .UDH   - A utility to delete all files of a specific definition

                  in all directories, and optionally sub-directories.

 UDH     .REG   - The Universal Directory Handler registration file.

 PROGRAMS.TXT   - HyperAct, Inc. list of products and services.

The registered version contains the following additional files :

 UDHX    .EXE   - The protected mode version of the UDH program.

 README  .UDH   - Special README file for the registered version.

 DPMI16I.OVL    - DPMI overlay module (Borland).

 RTM.EXE        - Borland DPMI Run Time Module.

 RTMRES.EXE     - Resident RTM version.

 DPMIINST.EXE   - DPMI configuration file.

 DPMILOAD.EXE   - DPMI Loader.

 DPMIUSER.DOC   - Notes about using Borland DPMI services.

Related Topics :

Overview

Operation


Installing The Universal Directory Handler

In order to install the Universal Directory Handler, copy the UDH.EXE file, and all the *.UDH files to a directory on the path. It is important that all the UDH command files (*.UDH) will be in the same directory as the UDH.EXE file.

When you want to create new UDH commands, we suggest that you keep the UDH "command" file in a separate directory, and test it from that directory, when you are sure that the command you created works to your satisfaction, move this "command" file to the directory where UDH.EXE resides.

The name of the commands you add must be unique, or they will overwrite other commands that you might find useful.


Theory of operation

The UDH program performs the following steps during it's operation :

 1. Parse user command and file selection.

 2. Collect files to internal database.

 3. Process internal database according to the defined UDH "command".

Parse user command and file selection.

The user defines the name of the UDH command, which is a text file, that includes the PASTERP commands for the file manipulation. This file includes special procedures that are processed during step 3 of the UDH program.

The user also defines sets of files to be manipulated by the UDH "command". These sets may include multiple wild-card selections, and can be from a specific directory, or a directory and all of it's sub-directories.

Collect files to internal database.

According to the file sets defined by the user in step 1, the UDH program scans the disk(s), and collects the name and information of each file that matches the file selections to the internal database.

Process internal database according to the defined UDH "command".

The UDH program scans the "command" file for a procedure named 'beforeFilePass'. If this procedure is found, it is called and manipulated.

The UDH program scans the internal database, and each file that is defined in this database is processed by the UDH "command" by calling the procedure named 'processFile'.

The internal database is sorted by file names, in directories. Because of that, the UDH program recognizes when a directory is about to begin, or has just ended. If a new directory is started, the UDH program will look for a procedure named 'beforeNewDir', and if found, will execute it. If the last file of a directory has just been processed, the UDH program will look for a procedure named 'afterDir', and if found, will execute it.

After all the files in the internal database have been processed, the UDH program looks for a procedure called 'afterFilePass', and if found, executes it.


OPERATION

The UDH program operation is as follows :

 udh [e-opt] cmndfile [e-opt] infile(s) [e-opt]

Where e-opt is a file of options, or the options described below, cmndfile is the name of the UDH "command" file, and infile(s) is the set of files that will be collected to the internal database, and manipulated by the UDH "command".

The options are :

/Q+ /Q-                           - Quiet Mode On/Off

/R                                - Recurse directories

/?                                - This page

If no extension is specified to the "command" file, an extension of .UDH is assumed.

The UDH program will try to look for the "command" file in the current directory, if it is not found there, it will look for it in the directory that the UDH.EXE program resides in.

Example

 udh sizesum *.pas /r

The above command will collect all the *.pas files, in the current directory and all of it's sub-directories, and process these files using the sizesum UDH "command" that can be found in the file SIZESUM.UDH . This file, if not found in the current directory, will be taken from the directory the UDH.EXE program resides in.

Example

 udh delall c:\*.bak /r c:\*.err /r

The UDH delall "command" is executed on all the *.bak and *.err files that exist on the C: drive.


Contacting HyperAct, Inc.

  Please contact :

  HyperAct, Inc.

  P.O.Box 5517

  Coralville IA 52241

  U.S.A

Phone/Fax - (319) 351-8413

e-mail address : Compuserve - 76350,333

  To contact the author directly :

  Contact :     Loewy Ron,

e-mail address : Compuserve - 100274,162

Related Topics :

Regsiteration

Overview


Registering the Universal Directory Handler

The Universal Directory Handler (UDH) is a shareware product, if you find this product valuable, please register it. This section describes the reasons you should register.

By registering you will receive a diskette with the latest UDH version, and DPMI (DOS protected mode) version of the UDH program.

Your registration will help us to create the next versions of UDH, that will include more options, and features, some of them might even be your enhancement requests!.

 1.     Order from HyperAct, Inc.:

 You can order directly from HyperAct Inc.. Please refer to the supplied

 UDH.REG file. Edit it, print it and mail it (with a check) to:

        HyperAct Inc.,

        P.O.Box 5517

        Coralville Iowa 52241, U.S.A

 2.     Order from PsL:

 You can order from Public (software) Library with your MC, Visa, AmEx

 or Discover card by calling 800-242-4PsL (from overseas: 713-524-6394) or

 by FAX to 713-524-6398 or by Compuserve to 71355,470.

 These numbers are for ordering only. HyperAct Inc. can NOT be reached at those

 numbers. Please contact HyperAct, Inc. directly for any other type of problem

 (technical or other), information or request.

Related Topics :

Contact

Overview


PASTERP Language

The language used to create a UDH "command" is a PASCAL-Like language, called PASTERP. PASTERP is an interpreted language, which is a subset of the PASCAL language, with some enhancements to simplify syntax checking, and a more relaxed parser.

The PASTERP language included with the UDH program has been enhanced to support special functions and procedures that are handy for file manipulation.

Related Topics :

 PASTERP Definition

 Extended Features


PASTERP UDH Specific functions and procedures

The following functions and procedures are defined in addition to the PASTERP standard library. These functions and procedures provide the functionality that can be useful when you want to manipulate files and directories, based on the files collected by the UDH program to it's internal database.

Current File Info and Statistics

 function currentDay : word

 function currentDir : string

 function currentExt : string

 function currentHour : word

 function currentMin : word

 function currentMonth : word

 function currentName : string

 function currentNameExt : string

 function currentPath : string

 function currentSec : word

 function currentSize : longint

 function currentYear : word

String Helper

 function strPadLeft(s : string; n : byte) : string

 function strPadRight(s : string; n : byte) : string

Misc. routines

 function diskFree : longint

 function diskSize : longint

 function eraseCurrent : boolean

 function exec(program, cmdline : string) : byte


function currentDir : string

function currentDir : string;

Returns the directory path of the current file being processed by the UDH program.

Example

procedure beforeNewDir;

        writeln('Starting directory : ', currentDir);

endProc;


function currentName : string

function currentName : string;

Returns the name (with no extensions) of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File Name      : ', currentName);

        writeln('File Extension : ', currentExt);

endProc;


function currentExt : string

function currentExt : string;

Returns the extension of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File Name      : ', currentName);

        writeln('File Extension : ', currentExt);

endProc;


function currentNameExt : string

function currentNameExt : string;

Returns the name (with the extension) of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File : ', currentNameExt, ' size : ', currentSize :8);

endProc;


function currentPath : string

function currentPath : string;

Returns the complete path (directory + filename + extension of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File Path ', currentPath);

endProc;


function currentSize : longint

function currentSize : longint;

Returns the size (in bytes) of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File : ', currentNameExt, ' size : ', currentSize :8);

endProc;


function currentDay : word

function currentDay : word;

Returns the day part of the time stamp of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File : ', currentNameExt, ' date : '

                 currentMonth : 2, '-', currentDay, '-', currentYear);

endProc;


function currentMonth : word

function currentMonth : word;

Returns the month part of the time stamp of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File : ', currentNameExt, ' date : '

                 currentMonth : 2, '-', currentDay, '-', currentYear);

endProc;


function currentYear : word

function currentYear : word;

Returns the year part of the time stamp of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File : ', currentNameExt, ' date : '

                 currentMonth : 2, '-', currentDay, '-', currentYear);

endProc;


function currentHour : word

function currentHour : word;

Returns the hour part of the time stamp of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File : ', currentNameExt, ' date : '

                 currentHour : 2, ':', currentMin, ':', currentSec);

endProc;


function currentMin : word

function currentMin : word;

Returns the minute part of the time stamp of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File : ', currentNameExt, ' date : '

                 currentHour : 2, ':', currentMin, ':', currentSec);

endProc;


function currentSec : word

function currentSec : word;

Returns the second part of the time stamp of the current file being processed by the UDH program.

Example

procedure ProcessName;

        writeln('File : ', currentNameExt, ' date : '

                 currentHour : 2, ':', currentMin, ':', currentSec);

endProc;


function strPadLeft(s : string; n : byte) : string

function strPadLeft(s : string; n : byte) : string;

The StrPadLeft function returns a string that contains (s), padded to it's left with blanks, to make a n characters long string. If the length of (s) is greater than (n), (s) is truncated to (n) characters, and returned.

Example

function padLeftCurrentFile : string

        padLeftCurrentFile := strPadLeft(currentNameExt, 12);

endproc

In the above example, the current file name and extension are returned as a 12 character string, with the file name at the right side of the string.

e.g. strPadLeft("MYFILE.DAT", 12) = "  MYFILE.DAT"


function strPadRight(s : string; n : byte) : string

function strPadRight(s : string; n : byte) : string;

The StrPadRight function returns a string that contains (s), padded to it's right with blanks, to make a n characters long string. If the length of (s) is greater than (n), (s) is truncated to (n) characters, and returned.

Example

function padRightCurrentFile : string

        padRightCurrentFile := strPadRight(currentNameExt, 12);

endproc

In the above example, the current file name and extension are returned as a 12 character string, with the file name at the left side of the string.

e.g. strPadRight("MYFILE.DAT", 12) = "MYFILE.DAT  "


function diskFree : longint

function diskFree : longint;

This function returns the free disk space on the directory that the current file is on, in bytes.

Example

procedure processFile

  writeln(currentDir, ' has ', diskFree, ' bytes free, out of ', diskSize);

endproc;


function diskSize : longint

function diskSize : longint;

This function returns the total disk space on the directory that the current file is on, in bytes.

Example

procedure processFile

  writeln(currentDir, ' has ', diskFree, ' bytes free, out of ', diskSize);

endproc;


function eraseCurrent : boolean

function eraseCurrent : boolean;

This function erases the current file, from the disk.

Example

procedure processFile

var

     answer : string;

endvar

        write(currentNameExt, ' will be deleted, continue ?');

        readln(answer);

        if ((answer = 'Y') or (answer = 'y')) then

                eraseCurrent;

endproc;


function exec(program, cmdline : string) : byte

function function exec(program, cmdline : string) : byte;

This function executes the program specified in the first parameter, with the command line parameters specified in the second parameter.

The function returns the DOS return code for the program.

Example

procedure processFile

        exec('Compress.exe', currentPath);

endproc;

This example calls a compress program to compress the current file.